@extends('admin')

@section('content')

    <div class="nav">
        <ul class="cc">
            <li class="current">
                <a href="{{url('admin/goods')}}">商品管理</a>
            </li>
        </ul>
    </div>

    <div class="h_a">搜索</div>
    <div class="search_type cc mb10">
        <form action="{{url('admin/goods')}}" method="get" class="search_form">

            <label for="search_store_name">店铺：</label><input type="text" name="store_name" value="{{$store_name}}" id="search_store_name" class="input length_2 mr10"/>
            <label for="search_goods_name">商品名称：</label><input type="text" name="goods_name" value="{{$goods_name}}" id="search_goods_name" class="input length_2 mr10"/>
            <label for="search_goods_status">状态：</label>
            <select name="goods_status" id="search_goods_status" class=" mr10">
                <option value="100" @if ($goods_status == 100) selected="selected" @endif>全部</option>
                <option value="1" @if ($goods_status == 1) selected="selected" @endif>上架</option>
                <option value="0" @if ($goods_status == 0) selected="selected" @endif>下架</option>
            </select>
            <button type="submit" class="btn">提交查询</button>
        </form>

    </div>

    <div class="table_list">
        <div id="data_list">
            <table class="items">
                <thead>
                <tr>
                    <th>商品名称</th>
                    <th>主图</th>
                    <th>店铺名称</th>
                    <th>价格（现价 / 市场价）</th>
                    <th>所属分类</th>
                    <th>评分</th>
                    <th>已售出</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach ($list as $item)
                    <tr>
                        <td>{{$item->title}}</td>
                        <td><img src="/img/goods-{{$item->pic}}/40-40" /></td>
                        <td>{{$item->store->store_name}}</td>
                        <td>{{$item->price}} / {{$item->market_price}}</td>
                        <td>{{$item->category->name}}</td>
                        <td>{{$item->score}}</td>
                        <td>{{$item->selled}}</td>
                        <td>@if ($item->status ==1) <span class="green">已上架</span> @else <span class="red">已下架</span> @endif</td>
                        <td>
                            <a href="{{url('admin/goods/update/'.$item->id)}}" title="编辑 {{$item->name}}" class="mr10 J_dialog">[编辑]</a>
                            <a href="{{url('admin/goods/delete/'.$item->id)}}" class="mr10 J_ajax_del">[删除]</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

        <div class="summary">
            共有 {{$list->total()}} 条数据
        </div>
        @if ($list->hasPages())
            <div class="pager">
                {!! $list->appends($appends)->render() !!}
            </div>
        @endif
    </div>

@stop